// 商品属性相关操作
import request,{Method} from '@/plugins/api.js'

// 获取售后信息
export function getAfterSaleInfo (params) {
    return request({
      url: '/order/aftersale/getAfterSaleInfo',
      method: Method.POST,
      data: params
    });
}

// 根据售后类型获取官方设定的售后原因
export function getAfterSaleReasonByType(type){
    return request({
        url : `/order/aftersalereason/getAfterSaleReasonByType/${type}`,
        method: Method.GET,
    })
}

// 申请售后
export function applyAfterSale (params) {
    return request({
      url: '/order/aftersale/applyAfterSale',
      method: Method.POST,
      data: params
    });
}

// 获取售后数据的分页信息
export function getAfterSalePage (params) {
    return request({
      url: '/order/aftersale/getAfterSalePage',
      method: Method.POST,
      data: params
    });
}

// 根据售后的sn号码获取售后的详情信息
export function getAfterSaleDetail (sn) {
  return request({
    url: `/order/aftersale/getAfterSaleDetail/${sn}`,
    method: Method.GET,
  });
}

// 根据售后sn号码获取售后日志
export function getAfterSaleLog (sn) {
  return request({
    url: `/order/aftersalelog/getAfterSaleLog/${sn}`,
    method: Method.GET,
  });
}

// 卖家 退货 物流接口
export function BuyerDelivery (params) {
    return request({
      url: '/order/aftersale/BuyerDelivery',
      method: Method.POST,
      data: params
    });
}

// 取消售后
export function cancel (params) {
    return request({
      url: '/order/aftersale/cancel',
      method: Method.POST,
      data: params
    });
}

// 添加订单投诉
export function addOrderComplaint (params) {
  return request({
    url: '/order/ordercomplaint/addOrderComplaint',
    method: Method.POST,
    data: params
  });
}

// 获取订单投诉的分页数据
export function getOrderComplaintByPage (params) {
  return request({
    url: '/order/ordercomplaint/getOrderComplaintByPage',
    method: Method.POST,
    data: params
  });
}

// 获取投诉详情
export function getOrderComplaintDetail (id) {
  return request({
    url: `/order/ordercomplaint/getOrderComplaintDetail/${id}`,
    method: Method.GET,
  });
}

// 取消订单投诉
export function cancelOrderComplaint (id) {
  return request({
    url: `/order/ordercomplaint/cancelOrderComplaint/${id}`,
    method: Method.PUT,
  });
}

// 投诉过程中三个角色进行交流
export function communication (params) {
  return request({
    url: '/order/ordercomplaintcommunication/communication',
    method: Method.POST,
    data: params
  });
}
